package modelo1;

import javax.persistence.EntityManager;
import javax.persistence.EntityManagerFactory;
import javax.persistence.Persistence;

			public class AdicionaEstadoGovernador {
				public static void main(String[] args) {
					EntityManagerFactory factory = Persistence
							.createEntityManagerFactory("mapeamentoDB");
					EntityManager manager = factory.createEntityManager();
					
					manager.getTransaction().begin();
		
		Governador g = new Governador();
		g.setNome("Madeira Junior");
		g.setPartido("PT");
		g.setNumerodopartido(23456);
		
		Estado e = new Estado();
		e.setNome("Parana");
		e.setGovernador(g);
		e.setRegiao("SUL");
		e.setCidade("Curitiba");
		
		
		manager.persist(g);
		manager.persist(e);

		manager.getTransaction().commit();
		manager.close();
		factory.close();
	}
}
